<template>
  <div class="coffee">
    <div
      class="colist"
      v-for="i in coffee"
      :key="i.id"
      @click="goDetail(i.pid)"
    >
      <img :src="i.smallImg" alt="" />
      <div class="name-box">
        <div class="name">{{ i.name }}</div>
        <div class="enname">{{ i.enname }}</div>
      </div>
      <div class="price">￥{{ i.price }}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: ["coffee"],
  methods: {
    //详情
    goDetail(pid) {
      this.$router.push({ name: "Detail", params: { pid } });
    },
  },
};
</script>

<style lang="less" scoped>
.coffee {
  width: 100%;
  min-height: 500px;
  box-sizing: border-box;
  padding: 10px 10px 50px 10px;
  .colist {
    width: 100%;
    background-color: #fff;
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    margin-bottom: 10px;
    img {
      width: 80px;
      height: 80px;
    }
    .name-box {
      font-size: 14px;
      color: #3d444d;
      text-align: left;
      padding: 10px;
      margin-right: auto;
      .name {
        margin: 10px 0 5px 0;
      }
      .enname {
        width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #8c9198;
      }
    }
    .price {
      font-size: 14px;
      line-height: 80px;
      font-weight: bold;
      color: #05a1f4;
    }
  }
}
</style>